// 用于加载对应的房间配置
var config = require('./config');

module.exports = {

    /**
     * 检查创建房间的参数
     * @param args
     * @return {boolean} 表示参数不正确，
     */
    checkCreateRoomArgs: function(args) {
        if (!args.gameType || !args.subType || !args.round) {
            return false;
        }

        if (!config.RoundMode.hasOwnProperty(args.costMode)) {
            return false;
        }

        var costModes = config.RoundMode[args.costMode];

        if (args.costMode == 1 && !costModes.hasOwnProperty(args.round)) {
            return false;
        }

        return true;
    },

    /**
     * 创建房间需要消耗的资源
     * @param args
     */
    calcCreateRoomNeedResource: function(args) {

        // 房主支付
        var costResore = 0;
        if (args.costMode == 1) {
            costResore = config.RoundMode[args.costMode][args.round];
        }else if (args.costMode == 4) {
            costResore = config.RoundMode[args.costMode];
        }

        return {
            "card": costResore
        };
    }
};